<h2>Why is this an issue?</h2>
<p>In JavaScript, props are typically passed as plain objects, which can lead to errors and confusion when working with components that have specific
prop requirements. However, it lacks of type safety and clarity when passing props to components in a codebase.</p>
<p>By defining types for component props, developers can enforce type safety and provide clear documentation for the expected props of a component.
This helps catch potential errors at compile-time. It also improves code maintainability by making it easier to understand how components should be
used and what props they accept.</p>
<h2>How to fix it</h2>
<h3>Code examples</h3>
<h4>Noncompliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
import PropTypes from 'prop-types';

function Hello({ firstname, lastname }) {
  return &lt;div&gt;Hello {firstname} {lastname}&lt;/div&gt;; // Noncompliant: 'lastname' type is missing
}
Hello.propTypes = {
  firstname: PropTypes.string.isRequired
};

// Using legacy APIs

class Hello extends React.Component {
  render() {
    return &lt;div&gt;Hello {this.props.firstname} {this.props.lastname}&lt;/div&gt;; // Noncompliant: 'lastname' type is missing
  }
}
Hello.propTypes = {
  firstname: PropTypes.string.isRequired,
};
</pre>
<h4>Compliant solution</h4>
<pre data-diff-id="1" data-diff-type="compliant">
import PropTypes from 'prop-types';

function Hello({ firstname, lastname }) {
  return &lt;div&gt;Hello {firstname} {lastname}&lt;/div&gt;;
}
Hello.propTypes = {
  firstname: PropTypes.string.isRequired,
  lastname: PropTypes.string.isRequired,
};

// Using legacy APIs

class Hello extends React.Component {
  render() {
    return &lt;div&gt;Hello {this.props.firstname} {this.props.lastname}&lt;/div&gt;;
  }
}
Hello.propTypes = {
  firstname: PropTypes.string.isRequired,
  lastname: PropTypes.string.isRequired,
};
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/jsx-eslint/eslint-plugin-react">eslint-plugin-react</a> - Rule <a
  href="https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/prop-types.md">prop-types</a> </li>
  <li> React Documentation - <a href="https://react.dev/reference/react/Component#static-proptypes">static propTypes</a> </li>
  <li> Flow.js Documentation - <a href="https://flow.org/en/docs/react/">React</a> </li>
</ul>
